﻿/*

  The contents of this file are subject to the Mozilla Public License Version
  1.1 (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at 
  
           http://www.mozilla.org/MPL/ 
  
  Software distributed under the License is distributed on an "AS IS" basis,
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  for the specific language governing rights and limitations under the License. 
  
  The Original Code is KazeOS Framework.
  
  The Initial Developer of the Original Code is
  ALCARAZ Marc (aka eKameleon) <ekameleon@gmail.com>.
  Portions created by the Initial Developer are Copyright (C) 2004-2010
  the Initial Developer. All Rights Reserved.
  
  Contributor(s) :
  
*/

/**
 * The user value objects.
 */
try
{
    dummy = User ;
}
catch( e /*Error*/ )
{
    
    /**
     * Creates a new User instance.
     * @param name The name of the user.
     * @param client The Client reference of the user.
     */
    function User( name /*String*/ , client /*Client*/ ) 
    {
        this.id     = name   ;
        this.name   = name   ;
        this.client = client ;
    }
    
    proto = User.prototype ;
    
    /**
     * The Client reference of the value object.
     */
    proto.client /*Client*/ = null ;
    
    /**
     * The id of the value object.
     */
    proto.id = null ;
    
    /**
     * The name of the value object.
     */
    proto.name /*String*/ = null ;
    
    /**
     * The peerID of the value object.
     */
    proto.peerID /*String*/ = null ;
    
    /**
     * The stream id of the user.
     */
    proto.streamID /*String*/ = null ;
    
    /**
     * Returns the string representation of this instance.
     * @return the string representation of this instance
     */
    proto.toString = function() /*String*/ 
    {
        return "[User id:" + this.id + ", name:" + this.name + "]";
    }
    
    // encapsulate 
    
    application.registerClass( "User" , User ) ;
    
    delete proto ;
    
}
